From 2c01d5bac9ec665b176622bd28517a78c8c38e19 Mon Sep 17 00:00:00 2001 From: "djm@kirby.fc.hp.com" Date: Tue, 20 Sep 2005 13:03:25 -0600 Subject: [PATCH] Get multiple domains working again Signed-off-by Kevin Tian Some interesting issues found related to two small patches: 1. Only "xm console 1" and "Ctrl + ]" can make xenU forward progress, and however still failed to connect blkback later. [Reason] Previous event injection on XEN/IPF only set vIRR bit when evtchn_set_pending. However with the latest xenlinux code, it's possible for xenlinux to set pending indication and selector when unmasking some pending event channel. This path has nothing to do with vIRR bit. [Solution] We should check event pending every time when checking pending interrupts before returning to guest. 2. After fixing first issue, nested event is injected when first event is still in handle with lock held. Then dead lock happens at end of "xend start". [Reason] Due to same logic as above, xenlinux may set pending indication and re-trigger pending event by force_evtchn_callback. On x86, this stub just does a dummy xen_version hypercall and pending event will be injected back when leaving hypervisor. However on IA64, force_evtchn_callback is incautiously made invoking evtchn_interrupt() directly, while the former may be called with lock held. [Solution] Just let force_evtchn_callback as empty for simple now. --- xen/arch/ia64/xen/domain.c | 2 +- xen/arch/ia64/xen/vcpu.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index f1bf1f3791..97b63af658 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -917,7 +917,7 @@ int construct_dom0(struct domain *d, #endif /* Mask all upcalls... */ - for ( i = 0; i < MAX_VIRT_CPUS; i++ ) + for ( i = 1; i < MAX_VIRT_CPUS; i++ ) d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1; #ifdef CONFIG_VTI diff --git a/xen/arch/ia64/xen/vcpu.c b/xen/arch/ia64/xen/vcpu.c index ec3c86e483..d650301242 100644 --- a/xen/arch/ia64/xen/vcpu.c +++ b/xen/arch/ia64/xen/vcpu.c @@ -21,6 +21,7 @@ int in_tpa = 0; #include #include #include +#include typedef union { struct ia64_psr ia64_psr; @@ -654,6 +655,15 @@ UINT64 vcpu_check_pending_interrupts(VCPU *vcpu) { UINT64 *p, *q, *r, bits, bitnum, mask, i, vector; + /* Always check pending event, since guest may just ack the + * event injection without handle. Later guest may throw out + * the event itself. + */ + if (event_pending(vcpu) && + !test_bit(vcpu->vcpu_info->arch.evtchn_vector, + &PSCBX(vcpu, insvc[0]))) + vcpu_pend_interrupt(vcpu, vcpu->vcpu_info->arch.evtchn_vector); + p = &PSCBX(vcpu,irr[3]); /* q = &PSCB(vcpu,delivery_mask[3]); */ r = &PSCBX(vcpu,insvc[3]); -- 2.30.2